﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ADOTestingLibrary;

namespace ADOConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            CRUDClass crud = new CRUDClass();
            List<Product> products;
            Product product;

            Console.WriteLine("----- SELECT ALL -----");
            products = crud.Select();
            foreach (Product p in products)
            {
                Console.WriteLine("{0} - {1} - {2}", p.ProductId, p.ProductName, p.Price);
            }
            Console.WriteLine("----- SELECT ALL -----\n");

            Console.WriteLine("----- SELECT1 -----");
            products = crud.Select1();
            foreach (Product p in products)
            {
                Console.WriteLine("{0} - {1} - {2}", p.ProductId, p.ProductName, p.Price);
            }
            Console.WriteLine("----- SELECT1 -----\n");

            Console.WriteLine("----- SELECT2 -----");
            product = crud.Select2();
            Console.WriteLine("{0} - {1} - {2}", product.ProductId, product.ProductName, product.Price);
            Console.WriteLine("----- SELECT2 -----\n");

            Console.WriteLine("----- UPDATE1 -----");
            product = crud.Update1();
            Console.WriteLine("{0} - {1} - {2}", product.ProductId, product.ProductName, product.Price);
            Console.WriteLine("----- UPDATE1 -----\n");

            Console.WriteLine("----- UPDATE2 -----");
            bool updateStatus = crud.Update2();
            Console.WriteLine("status = " + updateStatus);
            Console.WriteLine("----- UPDATE2 -----\n");

            Console.WriteLine("----- DELETE -----");
            crud.Delete();
            Console.WriteLine("----- DELETE -----\n");

            Console.WriteLine("----- SELECT ALL -----");
            products = crud.Select();
            foreach (Product p in products)
            {
                Console.WriteLine("{0} - {1} - {2}", p.ProductId, p.ProductName, p.Price);
            }
            Console.WriteLine("----- SELECT ALL -----\n");

            Console.ReadKey();
        }
    }
}
